export const getStatisticsSum = <T>(dataSource: T[], sumKey: string[], callback: (record: T, value: number[]) => any) => {
  let result: any[] = [];
  const _dataSource = JSON.parse(JSON.stringify(dataSource))
  // eslint-disable-next-line guard-for-in
  for (const dataSourceKey in _dataSource) {
    let value: number[]
    value = [...Array(sumKey.length).fill(0)]
    let record = _dataSource[dataSourceKey];

    // eslint-disable-next-line guard-for-in
    for (const dataSourceKey1 in _dataSource) {
      for (const keyIndex in sumKey) {
        value[keyIndex] = value[keyIndex] + _dataSource[dataSourceKey1][sumKey[keyIndex]];
      }
      if (dataSourceKey1 === dataSourceKey) {
        break
      }
    }
    let items = callback(record, value)
    result.push(items);
  }
  return result
}
